#ifndef __INIT_H_
#define __INIT_H_

#define u32             unsigned int

#define StartAddr       0xFFFF0200

#define ResetV          (*(volatile u32 *)(StartAddr + 0x00))
#define UndefV          (*(volatile u32 *)(StartAddr + 0x04))
#define SWIV            (*(volatile u32 *)(StartAddr + 0x08))
#define PAbortV         (*(volatile u32 *)(StartAddr + 0x0C))
#define DAbortV         (*(volatile u32 *)(StartAddr + 0x10))
#define UnusedV         (*(volatile u32 *)(StartAddr + 0x14))
#define IRQV            (*(volatile u32 *)(StartAddr + 0x18))
#define FIQV            (*(volatile u32 *)(StartAddr + 0x1C))

#define gotoStartAddr   (0xFFFF0200 + 0x7BC0)   // 在2nboot的末尾修改指令
#define ResetVGoto      (*(volatile u32 *)(gotoStartAddr + 0x00))
#define UndefVGoto      (*(volatile u32 *)(gotoStartAddr + 0x04))
#define SWIVGoto        (*(volatile u32 *)(gotoStartAddr + 0x08))
#define PAbortVGoto     (*(volatile u32 *)(gotoStartAddr + 0x0C))
#define DAbortVGoto     (*(volatile u32 *)(gotoStartAddr + 0x10))
#define UnusedVGoto     (*(volatile u32 *)(gotoStartAddr + 0x14))
#define IRQVGoto        (*(volatile u32 *)(gotoStartAddr + 0x18))
#define FIQVGoto        (*(volatile u32 *)(gotoStartAddr + 0x1C))

#define valStartAddr    (0xFFFF0200 + 0x7BE0)   // 存放要跳转的值
#define ResetVval       (*(volatile u32 *)(valStartAddr + 0x00))
#define UndefVval       (*(volatile u32 *)(valStartAddr + 0x04))
#define SWIVval         (*(volatile u32 *)(valStartAddr + 0x08))
#define PAbortVval      (*(volatile u32 *)(valStartAddr + 0x0C))
#define DAbortVval      (*(volatile u32 *)(valStartAddr + 0x10))
#define UnusedVval      (*(volatile u32 *)(valStartAddr + 0x14))
#define IRQVval         (*(volatile u32 *)(valStartAddr + 0x18))
#define FIQVval         (*(volatile u32 *)(valStartAddr + 0x1C))

void mmu_enable();           // MMU使能
void except_vector_init();  // 异常向量表重定向
void bss_init();            // .bss段初始化
void FPU_init();            // 使能FPU
void other_init();          // 其他

#endif
